package com.nuo.modules.poster.controller;

import java.util.Arrays;
import java.util.Map;

import com.nuo.modules.poster.entity.PosterEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.nuo.modules.poster.service.PosterService;
import com.nuo.common.utils.PageUtils;
import com.nuo.common.utils.R;



/**
 * 
 *
 * @author nuo
 * @email 3033616351@qq.com
 * @date 2022-11-04 16:36:38
 */
@RestController
@RequestMapping("poster")
public class PosterController {
    @Autowired
    private PosterService posterService;

    /**
     * 列表
     */
    @RequestMapping("/list")
        public R list(@RequestParam Map<String, Object> params){
        PageUtils page = posterService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
        public R info(@PathVariable("id") Long id){
		PosterEntity poster = posterService.getById(id);

        return R.ok().put("poster", poster);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
        public R save(@RequestBody PosterEntity poster){
		posterService.save(poster);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
        public R update(@RequestBody PosterEntity poster){
		posterService.updateById(poster);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
        public R delete(@RequestBody Long[] ids){
		posterService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
